<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="../../favicon.ico">

    <title>Narrow Jumbotron Template for Bootstrap</title>

    <!-- Bootstrap core CSS -->
    <link href="./../public/css/bootstrap.min.css" rel="stylesheet">

    <!-- Custom styles for this template -->
    <link href="./../public/css/jumbotron-narrow.css" rel="stylesheet">

</head>

<body>

    <div class="container">
        <div class="header clearfix">
            <nav>
                <ul class="nav nav-pills pull-right">
                    {% if user %}
                    <li role="presentation"><a href="/addNote">撰写</a></li>
                    <li role="presentation"><a href="/">首页</a></li>
                    <li role="presentation"><a href="#">关于</a></li>
                    <li role="presentation"><a href="#">联系</a></li>

                    {% if user.avatar==null %}
                    <li role="presentation"><img src="./../public/img/girl.png" alt="我的头像" height="40" width="40"
                            class="img-circle"></li>
                    {% else %}
                    <li role="presentation"><img src="./..{{ user.avatar }}" alt="我的头像" height="40" width="40"
                            class="img-circle"></li>
                    {% endif %}

                    {% if user.userName==null %}
                    <li role="presentation"><a href="/userInfo">当前用户：{{ user.email }}</a></li>
                    {% else %}
                    <li role="presentation"><a href="/editUserInfo">当前用户：{{ user.userName }}</a></li>
                    {% endif %}

                    <li role="presentation" class="active"><a href="/logout">退出</a></li>
                    {% else %}
                    <li role="presentation" class="active"><a href="/login">登录</a></li>
                    {% endif %}
                </ul>
            </nav>
            <h3 class="text-muted">留言板</h3>
        </div>

        <div>
            <table class="table table-hover">
                <thead>

                    {% if user %}
                    <tr>
                        <th>标题</th>
                        <th>发布时间</th>
                        <th>操作</th>
                    </tr>
                    {% else %}
                    <tr>
                        <th>标题</th>
                        <th>发布时间</th>
                    </tr>
                    {% endif %}

                </thead>
                <tbody>

                    {% if user %}

                    {% for item in note %}

                    <tr>
                        <td><a href="/clickNote?id={{ item.ID }}">{{ item.title }}</a></td>
                        <td>{{ item.dateTime }}</td>
                        <td>
                            <a href="/editNote?id={{ item.ID }}">编辑</a>
                            <a href="/delect?id={{ item.ID }}">删除</a>
                        </td>
                    </tr>

                    {% endfor %}

                    {% else %}

                    {% for item in note %}

                    <tr>
                        <td>{{ item.title }}</td>
                        <td>{{ item.dateTime }}</td>
                    </tr>

                    {% endfor %}

                    {% endif %}

                </tbody>
            </table>
        </div>

        {% if pageNum>1 %}

        {% for i in range(1, pageNum+1) %}
        <span><a href="/?page={{ i }}">{{ i }}</a></span>
        {% endfor %}

        {% endif %}

        <footer class="footer">
            <p>&copy; 2016 Company, Inc.</p>
        </footer>

    </div>
</body>

</html>